<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 查到符合条件的第一个值 并返回这个值
        var arr = [12,23,34,45];
        // item > 30
        // for(var i = 0;i < arr.length;i++){
        //     if(arr[i] > 30){
        //         console.log(arr[i]);
        //         break;
        //     }
        // }

        function find2(array,run){
            console.log(run); //
            for(var i = 0;i < array.length;i++){
               var a = run(array[i],i,array);
               console.log(a); //
               if(a) return array[i]; 
            }
        }
        var n = find2(arr,function(item){
            // 判断条件返回的是true/false
            return item > 30;
        })

        console.log(n); //
    </script>
</body>
</html>